<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../lib/vue2.6.10.js"></script>
</head>
<body>
    <div id="app">
        <ol>
            <todo-item
                v-for="item in groceryList"
                v-bind:todo="item"
                v-bind:key="item.id"
            ></todo-item>
        </ol>
    </div>
    <script>
        // Vue.component('todo-item', {
        //     template: '<li>这是一个待办项</li>'
        // });
        // ==================
        Vue.component('todo-item', {
            props: ['todo'],
            template: '<li>{{ todo.text }}</li>'
        });
        var app = new Vue({
            el: '#app',
            data: {
                groceryList: [
                    {id:0, text:'蔬菜'},
                    {id:1, text:'奶酪'},
                    {id:2, text:'随便其他什么人吃的东西'}
                ]
            }
        });
    </script>
</body>
</html>